package com.oocl.servlet;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.oocl.log4j.Log4j;
import com.oocl.util.JsonUtil;
import com.oocl.vo.MerchandiseVO;

/**
 * Servlet implementation class ClearAllItemsInCartServlet
 */
public class ClearAllItemsInCartServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		Map<String, MerchandiseVO> shoppingCart = new HashMap<String, MerchandiseVO>();
		session.setAttribute("shoppingCart",shoppingCart);
		Log4j.getLogger().info("session被清空后的值： "+ JsonUtil.parserToString(session.getAttribute("shoppingCart")));
	}

}
